package android.zhcs.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.zhcs.myapplication.databinding.ActivityMainActivity2ydyBinding;

import java.util.Timer;
import java.util.TimerTask;

public class MainActivity2ydy extends AppCompatActivity {
    int m = 3;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        supportRequestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

        WindowManager.LayoutParams lp = getWindow().getAttributes();
        getWindow().setAttributes(lp);
        super.onCreate(savedInstanceState);
        getSupportActionBar().hide();
                    ActivityMainActivity2ydyBinding binding = ActivityMainActivity2ydyBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        Timer timer = new Timer();
        TimerTask timerTask = new TimerTask() {
            @Override
            public void run() {
                m = m - 1;
                if(m == 0){
                    finish();
                    MainActivity.start(MainActivity2ydy.this);
                }
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        binding.djs.setText(m + "");
                    }
                });

            }
        };
        timer.schedule(timerTask,1000,1000);
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        if (hasFocus) {
            View decorView = getWindow().getDecorView();
            decorView.setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
        }
    }


}